#include "Common.fxh"

cbuffer cbPerObject
{
	float4x4 gWorld;
};

Texture2D gTexture;

struct VS_IN
{
	float3 posL     : POSITION;
	uint vID        : SV_VertexID;
};

struct VS_OUT
{
	float4 posH     : SV_POSITION;
	float2 texCoord : TEXCOORD0;
};
 
VS_OUT VS(VS_IN vIn)
{
	VS_OUT vOut;
	vOut.posH = mul(float4(vIn.posL, 1.0f), gWorld);
	
	if(vIn.vID == 0) vOut.texCoord = float2(0,1);
	else if(vIn.vID == 1) vOut.texCoord = float2(0,0);
	else if(vIn.vID == 2) vOut.texCoord = float2(1,1);
	else vOut.texCoord = float2(1,0);
	
	return vOut;
}

float4 PS(VS_OUT pIn) : SV_Target
{
	return float4(gTexture.Sample(gBilinearSam, pIn.texCoord).rgb, 1.0f);
}

technique11 Tech0
{
	pass P0
	{
		SetVertexShader( CompileShader( vs_5_0, VS() ) );
		SetGeometryShader( NULL );
		SetPixelShader( CompileShader( ps_5_0, PS() ) );
		
		SetDepthStencilState(DepthOff, 0);
		SetBlendState( NoBlend, float4( 0.0f, 0.0f, 0.0f, 0.0f ), 0xFFFFFFFF );
		SetRasterizerState(CullBack);
	}
}
